package com.techthinker.dreamBuilder.Activitites;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TabHost;

import com.techthinker.dreamBuilder.R;

public class SettingActivity extends TabActivity implements OnClickListener {
	private ImageButton home, back;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// full screen
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
		Window myWindow = this.getWindow();
		myWindow.setFlags(flag, flag);
		setContentView(R.layout.setting);

		// navBar event
		home = (ImageButton) findViewById(R.id.ImageButton_home);
		back = (ImageButton) findViewById(R.id.ImageButton_back);
		home.setOnClickListener(this);
		back.setOnClickListener(this);

		// tab
		Resources res = getResources();
		TabHost tabHost = getTabHost();
		tabHost.addTab(tabHost
				.newTabSpec("dictionary setting")
				.setIndicator(res.getText(R.string.set_dic),
						res.getDrawable(R.drawable.set_dictionary))
				.setContent(new Intent(this, Set_dictionaryActivity.class)));
		tabHost.addTab(tabHost
				.newTabSpec("system setting")
				.setIndicator(res.getText(R.string.set_sys),
						res.getDrawable(R.drawable.set_sys))
				.setContent(new Intent(this, Set_systemActivity.class)));

	}

	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.ImageButton_back:
			this.finish();
			break;
		case R.id.ImageButton_home:
			Intent toRoot = new Intent();
			toRoot.setClass(this, RootViewActivity.class);
			startActivity(toRoot);
			this.finish();
			break;
		}
	}
}
